package cn.edu.scau.cmi.zengdefeng.abstractFactory;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextArea;

public class Controller {
	@FXML
	private TextArea textarea;
	@FXML
	private Button product;
	@FXML
	private RadioButton wens;
	@FXML
	private RadioButton tianbang;
	@FXML
	private RadioButton aonong;
	@FXML
	private RadioButton pork;
	@FXML
	private RadioButton chicken;
	@FXML
	private RadioButton beef;
	
	private AbstractFactory factory=null;
	private Food food=null;
	
	@FXML
	public void setWens() {
		 factory=AbstractFactory.getFactory("Wens");
		
	}
	@FXML
	public void setAonong() {
		 factory=AbstractFactory.getFactory("Aonong");
		
	}
	@FXML
	public void setTianbang() {
		 factory=AbstractFactory.getFactory("Tianbang");
		
	}
	@FXML
	public void setPork() {
		 food=factory.createPork();
		 
	}
	@FXML
	public void setBeef() {
		 food=factory.createBeef();
		 
	}
	@FXML
	public void setChicken() {
		 food=factory.createChicken();
		 
	}
	@FXML
	public void finish() {
		textarea.appendText(food.play()+"\n");
		if(wens.isSelected())
		wens.fire();
		if(tianbang.isSelected())
		tianbang.fire();
		if(aonong.isSelected())
		aonong.fire();
		if(pork.isSelected())
		pork.fire();
		if(beef.isSelected())
		beef.fire();
		if(chicken.isSelected())
		chicken.fire();
		
	}

}
